package com.littleu.market.service.impl;

import com.littleu.market.service.ITokenService;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import java.util.HashMap;
import java.util.Map;

@Service
public class TokenServiceImpl implements ITokenService {
    @Override
    public String getUserToken(String code) {
        return "abc";
    }

    private void getWxResult(String code){
        String url = "https://api.weixin.qq.com/sns/jscode2session";
        Map<String, String> param = new HashMap<>();
        param.put("appid","222");
        param.put("secret", "3333");
        param.put("js_code", code);
        param.put("grant_type", "authorization_code");

        RestTemplate restTemplate = new RestTemplate();
        String str = restTemplate.getForObject(url, String.class, param);
    }
}
